﻿using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using Elysium.Controls;
using Elysium.Demo.Configuracion.Empresa;
using Elysium.Demo.Ventas.Transacciones;
using SIIE_ERP.Codigo;

namespace Elysium.Demo.Ventas
{
    /// <summary>
    /// Lógica de interacción para Menu_Configuracion.xaml
    /// </summary>
    public partial class Menu_Ventas : UserControl
    {
        private UsuarioActivo _sesion;

        public Menu_Ventas(ref UsuarioActivo usuario)
        {            
            InitializeComponent();
            this._sesion = usuario;
        }

        private void Expander_Catalogos_Expanded(object sender, RoutedEventArgs e)
        {
            if (Expander_Transacciones != null)
                Expander_Transacciones.IsExpanded = false;
            if (Expander_Arrendamiento != null)
                Expander_Arrendamiento.IsExpanded = false;
            if (Expander_Honorarios != null)
                Expander_Honorarios.IsExpanded = false;
            if (Expander_Reportes != null)
                Expander_Reportes.IsExpanded = false;
        }

        private void Expander_Transacciones_Expanded(object sender, RoutedEventArgs e)
        {
            if (Expander_Catalogos != null)
                Expander_Catalogos.IsExpanded = false;
            if (Expander_Arrendamiento != null)
                Expander_Arrendamiento.IsExpanded = false;
            if (Expander_Honorarios != null)
                Expander_Honorarios.IsExpanded = false;
            if (Expander_Reportes != null)
                Expander_Reportes.IsExpanded = false;
        }

        private void Expander_Honorarios_Expanded(object sender, RoutedEventArgs e)
        {
            if (Expander_Catalogos != null)
                Expander_Catalogos.IsExpanded = false;
            if (Expander_Transacciones != null)
                Expander_Transacciones.IsExpanded = false;
            if (Expander_Arrendamiento != null)
                Expander_Arrendamiento.IsExpanded = false;
            if (Expander_Reportes != null)
                Expander_Reportes.IsExpanded = false;
        }

        private void Expander_Arrendamiento_Expanded(object sender, RoutedEventArgs e)
        {
            if (Expander_Catalogos != null)
                Expander_Catalogos.IsExpanded = false;
            if (Expander_Transacciones != null)
                Expander_Transacciones.IsExpanded = false;
            if (Expander_Honorarios != null)
                Expander_Honorarios.IsExpanded = false;
            if (Expander_Reportes != null)
                Expander_Reportes.IsExpanded = false;
        }

        private void Expander_Reportes_Expanded_1(object sender, RoutedEventArgs e)
        {
            if (Expander_Catalogos != null)
                Expander_Catalogos.IsExpanded = false;
            if (Expander_Transacciones != null)
                Expander_Transacciones.IsExpanded = false;
            if (Expander_Honorarios != null)
                Expander_Honorarios.IsExpanded = false;
            if (Expander_Arrendamiento != null)
                Expander_Arrendamiento.IsExpanded = false;
        }

        private void ButtonInmuebles_Click(object sender, RoutedEventArgs e)
        {
            ScrollViewVentas.Content = new Arrendamiento.Inmuebles_Consulta(ref _sesion);
        }

        private void ButtonClientes_Click(object sender, RoutedEventArgs e)
        {
            ScrollViewVentas.Content = new Catalogos.Clientes_Consulta(ref _sesion);
        }

        private void ButtonGrupoClientes_Click(object sender, RoutedEventArgs e)
        {
            ScrollViewVentas.Content = new Catalogos.GrupoClientes_Consulta(ref _sesion);
        }

        private void Button_NotasCredito_Click(object sender, RoutedEventArgs e)
        {
            ScrollViewVentas.Content = new Transacciones.NotaCredito_Consulta(ref _sesion);
        }

        private void Button_Devoluciones_Click(object sender, RoutedEventArgs e)
        {
            ScrollViewVentas.Content = new Transacciones.Devolucion_Consulta(ref _sesion);
        }

        private void Button_Facturas_Click(object sender, RoutedEventArgs e)
        {
            ScrollViewVentas.Content = new Transacciones.Factura_Consulta(ref _sesion);
        }

        private void Button_Remisiones_Click_1(object sender, RoutedEventArgs e)
        {
            ScrollViewVentas.Content = new Transacciones.Remision_Consulta(ref _sesion);
        }
        private void ButtonEmail_Click(object sender, RoutedEventArgs e)
        {
            ScrollViewVentas.Content = new Transacciones.CorreoEnviaClientes(ref _sesion);
        }
        private void Button_Pedidos_Click(object sender, RoutedEventArgs e)
        {
            ScrollViewVentas.Content = new Transacciones.Pedido_Consulta(ref _sesion);
        }

        private void ButtonCotizaciones_Click(object sender, RoutedEventArgs e)
        {
            ScrollViewVentas.Content = new Transacciones.Cotizacion_Consulta(ref _sesion);
        }

        private void ButtonHonorarios_Click_1(object sender, RoutedEventArgs e)
        {
            ScrollViewVentas.Content = new Elysium.Demo.Ventas.Honorarios.ReciboHonorarios_Consulta(ref _sesion);
        }

        private void ButtonArrendamiento_Click_1(object sender, RoutedEventArgs e)
        {
            ScrollViewVentas.Content = new Elysium.Demo.Ventas.Arrendamiento.ReciboArrendamiento_Consulta(ref _sesion);
        }

        private void ButtonReporte1_Click_1(object sender, RoutedEventArgs e)
        {
            System.Windows.Window window = new System.Windows.Window
            {
                Title = "Análisis de Ventas",
                Content = new ScrollViewer()
                {
                    Content = new Elysium.Demo.Informes.Seleccion_Ventas_GraficaMaster(ref _sesion, true),
                    HorizontalScrollBarVisibility = ScrollBarVisibility.Auto,
                    VerticalScrollBarVisibility = ScrollBarVisibility.Auto
                },
                Height = 585,
                Width = 1335,
                WindowStyle = System.Windows.WindowStyle.ToolWindow,
                ResizeMode = ResizeMode.CanResize,
                WindowState = WindowState.Normal,
                WindowStartupLocation = WindowStartupLocation.CenterScreen,
                Icon = new BitmapImage(new Uri("pack://application:,,,/Imagenes/SIE.ico")),
            };

            window.Show();

            //Elysium.Demo.Informes.Seleccion_Ventas_GraficaMaster MiReporte = new Informes.Seleccion_Ventas_GraficaMaster(ref _sesion, true);
            
            //Viewbox MiVB = new Viewbox();
            //MiVB.Child = MiReporte;

            //ScrollViewVentas.HorizontalScrollBarVisibility = ScrollBarVisibility.Visible;
            //ScrollViewVentas.VerticalScrollBarVisibility = ScrollBarVisibility.Visible;
            //ScrollViewVentas.MaxWidth = 1200;
            //ScrollViewVentas.MaxHeight = 526;

            //ScrollViewVentas.Content = MiVB;
        }

        private void ButtonReporte2_Click_1(object sender, RoutedEventArgs e)
        {
            Elysium.Demo.Informes.Seleccion_Ventas_Cliente MiReporte = new Informes.Seleccion_Ventas_Cliente(ref _sesion, "Informes/Reportes/Operativos/Ventas/Clientes.rdlc", true);
            
            Viewbox MiVB = new Viewbox();
            MiVB.Child = MiReporte;

            ScrollViewVentas.HorizontalScrollBarVisibility = ScrollBarVisibility.Visible;
            ScrollViewVentas.VerticalScrollBarVisibility = ScrollBarVisibility.Visible;
            ScrollViewVentas.MaxWidth = 1200;
            ScrollViewVentas.MaxHeight = 526;

            ScrollViewVentas.Content = MiVB;            
        }

        private void ButtonReporte3_Click_1(object sender, RoutedEventArgs e)
        {
            Elysium.Demo.Informes.GenericReport MiReporte = new Informes.GenericReport(ref _sesion, "Informes/Reportes/Operativos/Ventas/Grupos_Cliente.rdlc", true);
            
            Viewbox MiVB = new Viewbox();
            MiVB.Child = MiReporte;

            ScrollViewVentas.HorizontalScrollBarVisibility = ScrollBarVisibility.Visible;
            ScrollViewVentas.VerticalScrollBarVisibility = ScrollBarVisibility.Visible;
            ScrollViewVentas.MaxWidth = 1200;
            ScrollViewVentas.MaxHeight = 526;

            ScrollViewVentas.Content = MiVB;  
        }

        private void ButtonReporte4_Click_1(object sender, RoutedEventArgs e)
        {
            Elysium.Demo.Informes.Seleccion_Ventas MiReporte = new Informes.Seleccion_Ventas(ref _sesion, "Informes/Reportes/Operativos/Ventas/Cotizaciones.rdlc", SIIE_ERP.BaseDatos.Documentos_Id.Doc_CotizacionVenta, true);
            
            Viewbox MiVB = new Viewbox();
            MiVB.Child = MiReporte;

            ScrollViewVentas.HorizontalScrollBarVisibility = ScrollBarVisibility.Visible;
            ScrollViewVentas.VerticalScrollBarVisibility = ScrollBarVisibility.Visible;
            ScrollViewVentas.MaxWidth = 1200;
            ScrollViewVentas.MaxHeight = 526;

            ScrollViewVentas.Content = MiVB;  
        }

        private void ButtonReporte5_Click_1(object sender, RoutedEventArgs e)
        {
            Elysium.Demo.Informes.Seleccion_Ventas MiReporte = new Informes.Seleccion_Ventas(ref _sesion, "Informes/Reportes/Operativos/Ventas/Pedidos.rdlc", SIIE_ERP.BaseDatos.Documentos_Id.Doc_Pedido, true);
            
            Viewbox MiVB = new Viewbox();
            MiVB.Child = MiReporte;

            ScrollViewVentas.HorizontalScrollBarVisibility = ScrollBarVisibility.Visible;
            ScrollViewVentas.VerticalScrollBarVisibility = ScrollBarVisibility.Visible;
            ScrollViewVentas.MaxWidth = 1200;
            ScrollViewVentas.MaxHeight = 526;

            ScrollViewVentas.Content = MiVB;  
        }

        private void ButtonReporte6_Click_1(object sender, RoutedEventArgs e)
        {
            Elysium.Demo.Informes.Seleccion_Ventas MiReporte = new Informes.Seleccion_Ventas(ref _sesion, "Informes/Reportes/Operativos/Ventas/Remisiones.rdlc", SIIE_ERP.BaseDatos.Documentos_Id.Doc_Remision, true);
            
            Viewbox MiVB = new Viewbox();
            MiVB.Child = MiReporte;

            ScrollViewVentas.HorizontalScrollBarVisibility = ScrollBarVisibility.Visible;
            ScrollViewVentas.VerticalScrollBarVisibility = ScrollBarVisibility.Visible;
            ScrollViewVentas.MaxWidth = 1200;
            ScrollViewVentas.MaxHeight = 526;

            ScrollViewVentas.Content = MiVB;  
        }

        private void ButtonReporte7_Click_1(object sender, RoutedEventArgs e)
        {
            Elysium.Demo.Informes.Seleccion_Ventas MiReporte = new Informes.Seleccion_Ventas(ref _sesion, "Informes/Reportes/Operativos/Ventas/Facturas_Clientes.rdlc", SIIE_ERP.BaseDatos.Documentos_Id.Doc_FacturaCliente, true);
            
            Viewbox MiVB = new Viewbox();
            MiVB.Child = MiReporte;

            ScrollViewVentas.HorizontalScrollBarVisibility = ScrollBarVisibility.Visible;
            ScrollViewVentas.VerticalScrollBarVisibility = ScrollBarVisibility.Visible;
            ScrollViewVentas.MaxWidth = 1200;
            ScrollViewVentas.MaxHeight = 526;

            ScrollViewVentas.Content = MiVB;  
        }

        private void ButtonReporte8_Click_1(object sender, RoutedEventArgs e)
        {
            Elysium.Demo.Informes.Seleccion_Ventas MiReporte = new Informes.Seleccion_Ventas(ref _sesion, "Informes/Reportes/Operativos/Ventas/Devoluciones.rdlc", SIIE_ERP.BaseDatos.Documentos_Id.Doc_DevolucionCliente, true);
            
            Viewbox MiVB = new Viewbox();
            MiVB.Child = MiReporte;

            ScrollViewVentas.HorizontalScrollBarVisibility = ScrollBarVisibility.Visible;
            ScrollViewVentas.VerticalScrollBarVisibility = ScrollBarVisibility.Visible;
            ScrollViewVentas.MaxWidth = 1200;
            ScrollViewVentas.MaxHeight = 526;

            ScrollViewVentas.Content = MiVB;  
        }

        private void ButtonReporte9_Click_1(object sender, RoutedEventArgs e)
        {
            Elysium.Demo.Informes.Seleccion_Ventas MiReporte = new Informes.Seleccion_Ventas(ref _sesion, "Informes/Reportes/Operativos/Ventas/Notas_Credito.rdlc", SIIE_ERP.BaseDatos.Documentos_Id.Doc_NotaCreditoCliente, true);
            
            Viewbox MiVB = new Viewbox();
            MiVB.Child = MiReporte;

            ScrollViewVentas.HorizontalScrollBarVisibility = ScrollBarVisibility.Visible;
            ScrollViewVentas.VerticalScrollBarVisibility = ScrollBarVisibility.Visible;
            ScrollViewVentas.MaxWidth = 1200;
            ScrollViewVentas.MaxHeight = 526;

            ScrollViewVentas.Content = MiVB;  
        }

        private void ButtonReporte10_Click_1(object sender, RoutedEventArgs e)
        {
            Elysium.Demo.Informes.GenericReport MiReporte = new Informes.GenericReport(ref _sesion, "Informes/Reportes/Operativos/Ventas/AntiguedadSaldoCXC.rdlc", true);

            Viewbox MiVB = new Viewbox();
            MiVB.Child = MiReporte;

            ScrollViewVentas.HorizontalScrollBarVisibility = ScrollBarVisibility.Visible;
            ScrollViewVentas.VerticalScrollBarVisibility = ScrollBarVisibility.Visible;
            ScrollViewVentas.MaxWidth = 1200;
            ScrollViewVentas.MaxHeight = 526;

            ScrollViewVentas.Content = MiVB;
            
        }

       
    }
}
